package com.example.ai_agent.demo.invoke;

import com.alibaba.cloud.ai.dashscope.api.DashScopeApi;
import jakarta.annotation.Resource;
import org.springframework.ai.chat.client.advisor.api.Advisor;
import org.springframework.ai.chat.messages.AssistantMessage;
import org.springframework.ai.chat.model.ChatModel;
import org.springframework.ai.chat.prompt.Prompt;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

/**
 * @author Yan.z.h
 * @version 1.0
 */
@Component
public class springAIInvoke implements CommandLineRunner {
    @Resource
    private ChatModel dashcopeChatModel;
//      Advisor

    @Override
    public void run(String... args) throws Exception {
        AssistantMessage assistantMessage = dashcopeChatModel.call(new Prompt("你好，我是帅比")).getResult().getOutput();
        System.out.println("assistantMessage = " + assistantMessage);
    }
}
